<body onload="setCookie()">

<script>
function setCookie() {
    document.cookie = "username=John Doe; path=/";
}
</script>
This is a cookie test page.
</body>